package com.iwhalecloud.bss.kite.cucc.service.attr.linkhandler;

import com.iwhalecloud.bss.kite.client.api.scene.operate.IOperateSceneCommonService;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.LocalInstallAddressAttrHandler;
import com.iwhalecloud.bss.kite.cucc.service.attr.handler.LocationAccessAttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.annotation.AttrHandler;
import com.iwhalecloud.bss.kite.listener.handler.attr.impl.AbstractAttrLinkageHandler;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.scene.attr.OperateInstAttrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * @Classname LocationAccessAttrLinkHandler
 * @Description 获取 省市县 组合组件的值，逗号分隔的字符串，分隔后回填到 省、市、县 对应的各个属性中去
 * @Author cheng.leizhen01
 * @Date 2021-03-23 14:53
 */
@Service
@AttrHandler(LocationAccessAttrHandler.class)
public class LocationAccessAttrLinkHandler extends AbstractAttrLinkageHandler<AttrData> {

    @Override
    public void handle(KiteAttr attr, KiteInst inst, AttrData data) {
        if (Objects.isNull(attr)) {
            return;
        }
        // 大带框接入地 属性值调整
         if(KiteStringUtils.isNotEmpty(attr.getValueDesc())){
            attr.setValue(attr.getValueDesc());
        }
    }

    @Override
    public void handleStyle(KiteAttr attr, KiteInst inst, AttrData data) {

    }
}
